使用 CSS 以平滑的圆周运动制作 SVG 动画

您所在的位置:网站首页 css 倾斜的圆周运动是什么 使用 CSS 以平滑的圆周运动制作 SVG 动画

使用 CSS 以平滑的圆周运动制作 SVG 动画

#使用 CSS 以平滑的圆周运动制作 SVG 动画| 来源: 网络整理| 查看: 265

最后一个踏板也挂了一点...... 那是因为--total-animation-duration相对于动画延迟,它大于花瓣完成一个周期所需的时间(这是您用来计算动画的公式的结果) -延迟。) 解决方案- 将--animation-speed增加到0.6s。(如果您想将其保持为 0.4 秒,则必须将 --total-animation-duration 减少到 2 秒。)第二个问题是花瓣在动画开始时完全可见。

:root { --animation-speed: 0.6s; /* Total animation time for each petal */ --fill-time: 0.1s; /* Time each petal stays filled before the next starts */ --total-animation-duration: 3s; /* Total cycle time */ } body { background: black } .icon__flower { display: block; height: 105px; margin: auto; width: 110px; } /* Keyframes for the fill animation */ @keyframes fillAnimation { 0%, 100% { fill-opacity: 0; } 5%, 25% { fill-opacity: 1; } } /* Apply the fill animation to each petal */ .icon__flower path { fill-opacity: 0; animation: fillAnimation var(--total-animation-duration) infinite; } .icon__flower path:nth-child(1) { animation-delay: calc(0 * var(--animation-speed) + var(--fill-time)); } .icon__flower path:nth-child(2) { animation-delay: calc(1 * var(--animation-speed) + var(--fill-time)); } .icon__flower path:nth-child(3) { animation-delay: calc(2 * var(--animation-speed) + var(--fill-time)); } .icon__flower path:nth-child(4) { animation-delay: calc(3 * var(--animation-speed) + var(--fill-time)); } .icon__flower path:nth-child(5) { animation-delay: calc(4 * var(--animation-speed) + var(--fill-time)); }



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3